package com.yishun.springboot.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.RequestYunZhuWang.MainRealNameSystemInterface;
import com.alibaba.fastjson.JSONObject;

/**
 * 完全转发云筑网返回
 * @author XiaoHuang
 *
 */
@Service
public class RealNameSystemInterfaceService {
	
	String projectKey=   "86c6ef8ef5514a0eae7b1556765f87b3"; 
	String projectCode="321837";
	
	/**
	 * 获取所有的地区数据列表
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetAreaList(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetAreaList(jsonObject);
	}
	
	/**
	 * 获取所有的配置数据列表(带时间戳)
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetCommonConfigList(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetCommonConfigList(jsonObject);
	}
	
	/**
	 * 获取所有的通用字典数据列表(带时间戳)
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetCommonDictList(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetCommonDictList(jsonObject);
	}
	
	/**
	 * 获取所有的通用字典类型列表
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetCommonDictTypeList(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetCommonDictTypeList(jsonObject);
	}
	
	/**
	 * 获取所有的工种字典数据列表(带时间戳)
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetWorkTypeDictList(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetWorkTypeDictList(jsonObject);
	}
	
	/**
	 * 分页模式通过项目编号、上一次获取时间，获取这段时间内更新了的所有工人实名信息
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetWorkerInfoList(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetWorkerInfoList(jsonObject);
	}
	
	/**
	 * 通过ProjectCode获取本项目信息
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetProjectMaster(JSONObject jsonObject,JSONObject headerJsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();  //请求的底层方法实例
		this.projectKey = headerJsonObject.getString("projectKey");                         //将请求头部信息通过set到类变量完成变量赋值，至此头部信息不用在方法里面动作，以下皆同
        this.projectCode = headerJsonObject.getString("projectCode");
		realNameSystemInterface.setProjectCode(projectCode);   
		realNameSystemInterface.setProjectKey(projectKey);
		return realNameSystemInterface.GetProjectMaster(jsonObject);
	}
	
	/**
	 * 通过ProjectCode获取本项目分包商信息
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetSubcontractorList(JSONObject jsonObject,JSONObject headerJsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();  
		this.projectKey = headerJsonObject.getString("projectKey");
        this.projectCode = headerJsonObject.getString("projectCode");
		realNameSystemInterface.setProjectCode(projectCode);   
		realNameSystemInterface.setProjectKey(projectKey);
		return realNameSystemInterface.GetSubcontractorList(jsonObject);
	}
	
	/**
	 * 通过ProjectCode获取本项目班组基础信息(带时间戳)
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetTeamMaster(JSONObject jsonObject,JSONObject headerJsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		this.projectKey = headerJsonObject.getString("projectKey");
        this.projectCode = headerJsonObject.getString("projectCode");
		realNameSystemInterface.setProjectCode(projectCode);   
		realNameSystemInterface.setProjectKey(projectKey);
		return realNameSystemInterface.GetTeamMaster(jsonObject);
	}
	
	/**
	 * 通过ProjectCode获取本项目班组成员信息(带时间戳)
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetTeamMember(JSONObject jsonObject,JSONObject headerJsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		this.projectKey = headerJsonObject.getString("projectKey");
        this.projectCode = headerJsonObject.getString("projectCode");
		realNameSystemInterface.setProjectCode(projectCode);   
		realNameSystemInterface.setProjectKey(projectKey);
		return realNameSystemInterface.GetTeamMember(jsonObject);
	}
	
	/**
	 * 通过ProjectCode获取本项目班组成员信息(带时间戳)
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetTeamMember_O(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetTeamMember_O(jsonObject);
	}
	
	/**
	 * 获取总包方通用配置信息
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetContractorProjectConfig(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetContractorProjectConfig(jsonObject);
	}
	
	
	/**
	 * 获取项目工人考勤记录（最新版本）耦合分离版本
	 * @param jsonObject JSONObject(装载header信息 projectkKey & projectCode)
	 * @return
	 * @throws Exception
	 * {"ProjectCode":"325437","BeginDate":"2021-05-15","EndDate":"2021-05-17","WorkerName":"关振"}
                     必填                                                 可选                                                         可选                                                   可选
	 */
	public String GetProjectAttendanceListNew(JSONObject jsonObject,JSONObject headerJsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
        this.projectKey = headerJsonObject.getString("projectKey");
        this.projectCode = headerJsonObject.getString("projectCode");
		realNameSystemInterface.setProjectCode(projectCode);   
		realNameSystemInterface.setProjectKey(projectKey);
		
		return realNameSystemInterface.GetProjectAttendanceListNew(jsonObject);
	}
	
	/**
	 * 获取项目工人列表
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetWorkerList(JSONObject jsonObject,JSONObject headerJsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		this.projectKey = headerJsonObject.getString("projectKey");
        this.projectCode = headerJsonObject.getString("projectCode");
		realNameSystemInterface.setProjectCode(projectCode);   
		realNameSystemInterface.setProjectKey(projectKey);
		return realNameSystemInterface.GetWorkerList(jsonObject);
	}
	
	/**
	 * 获取项目工人考勤数据列表（最新版本）
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetWorkerAttendanceListNew(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetWorkerAttendanceListNew(jsonObject);
	}
	
	/**
	 * 获取工人职业履历
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetWorkerProjectHistoryList(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetWorkerProjectHistoryList(jsonObject);
	}
	
	/**
	 * 获取身份证阅读器配置
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String GetIDCardReaderConfig(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		return realNameSystemInterface.GetIDCardReaderConfig(jsonObject);
	}
	
	/**
	 * 项目层首页统计
	 * @param jsonObject
	 * @return
	 * @throws Exception
	 */
	public String QueryProjectRealTimeInfo(JSONObject jsonObject,JSONObject headerJsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
		this.projectKey = headerJsonObject.getString("projectKey");
        this.projectCode = headerJsonObject.getString("projectCode");
		realNameSystemInterface.setProjectCode(projectCode);   
		realNameSystemInterface.setProjectKey(projectKey);
		return realNameSystemInterface.QueryProjectRealTimeInfo(jsonObject);
	}
	
	/**
	 * 获取总包信息
	 * @param jsonObject
	 * @return
	 * @throws Exception   ,JSONObject headerJsonObject
	 */
	public String GetContractorInfo(JSONObject jsonObject) throws Exception {
		MainRealNameSystemInterface realNameSystemInterface = new MainRealNameSystemInterface();
//		this.projectKey = headerJsonObject.getString("projectKey");
//        this.projectCode = headerJsonObject.getString("projectCode");
//		realNameSystemInterface.setProjectCode(projectCode);   
//		realNameSystemInterface.setProjectKey(projectKey);
		return realNameSystemInterface.GetContractorInfo(jsonObject);
	}
	
}